import random
# 生成中奖号码
winning_numbers = random.sample(range(1, 34), 8)

# 用户输入购买的彩票号码
ticket_numbers = []
for i in range(8):
    num = input("请输入第{}个数字（1-33）：".format(i+1))
    ticket_numbers.append(int(num))

# 对比中奖号码和彩票号码
count = 0
for i in range(8):
    if ticket_numbers[i] == winning_numbers[i]:
        count += 1
#中奖号码
print("中奖号码为：", winning_numbers)
# 根据对比结果输出中奖信息
if count == 8:
    print("恭喜您中了一等奖！")
elif count == 7:
    print("恭喜您中了二等奖！")
elif count == 6:
    print("恭喜您中了三等奖！")
elif count == 5 or count == 4:
    print("恭喜您中了四等奖！")
else:
    print("很遗憾，您没有中奖。")

# 模拟随机购买10000注彩票对特定号码的中奖概率
count = 0
for i in range(10000):
    lottery_numbers = random.sample(range(1, 34), 8)
    if lottery_numbers == winning_numbers:
        count += 1
print("模拟随机购买10000注彩票，其中有{}注中了一等奖，中奖概率为{:.5f}%。".format(count, count/10000*100))